﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using App.Account.Models;
using App.Utility.Paging;
using App.Account.Models.Forms;
using App.Utility.Services;

namespace App.Account.Services
{
    [ServiceContract]
    public interface IAccountService : IDisposable
    {
        /// <summary>
        /// Gets a specific user
        /// </summary>
        /// <param name="ID">The user id</param>
        /// <returns>User matched by id</returns>
        [OperationContract]
        User GetUser(Guid ID);


        /// <summary>
        /// Gets a specific role
        /// </summary>
        /// <param name="ID">The role id</param>
        /// <returns>Role matched by id</returns>
        [OperationContract]
        Role GetRole(Guid ID);

        /// <summary>
        /// Attempts to get a user by name
        /// </summary>
        /// <param name="UserName">the user name</param>
        /// <returns></returns>
        [OperationContract]
        ServiceResponse<User> GetUserByName(string UserName);


        /// <summary>
        /// Attempts to get a role by name
        /// </summary>
        /// <param name="RoleName">the role name</param>
        /// <returns></returns>
        [OperationContract]
        ServiceResponse<Role> GetRoleByName(string RoleName);


        /// <summary>
        /// Gets a page
        /// </summary>
        /// <returns>List of users, unfiltered</returns>
        [OperationContract]
        PageResponse<User> GetUserPage(PageRequest PageRequest);



        /// <summary>
        /// Gets a page
        /// </summary>
        /// <returns>List of roles, unfiltered</returns>
        [OperationContract]
        PageResponse<Role> GetRolePage(PageRequest PageRequest);


        /// <summary>
        /// Saves the user to the repository with update/add as appropriate.
        /// </summary>
        /// <param name="user">The user to update/add</param>
        [OperationContract]
        void SaveUser(User user);


        /// <summary>
        /// Saves the role to the repository with update/add as appropriate.
        /// </summary>
        /// <param name="role">The role to update/add</param>
        [OperationContract]
        void SaveRole(Role role);

        /// <summary>
        /// Removes a user from the repository
        /// </summary>
        /// <param name="user">The user to remove</param>
        [OperationContract]
        void DeleteUser(User user);


        /// <summary>
        /// Removes a role from the repository
        /// </summary>
        /// <param name="user">The role to remove</param>
        [OperationContract]
        void DeleteRole(Role role);

        [OperationContract]
        ServiceResponse AttemptChangePassword(ChangePassword Form);

        [OperationContract]
        ServiceResponse<User> AttemptLogin(Login Form);

        [OperationContract]
        ServiceResponse<User> AttemptRegister(Register Form);


        [OperationContract]
        ServiceResponse<User> AttemptUserEdit(UserForm Form);

        [OperationContract]
        ServiceResponse<Role> AttemptRoleEdit(RoleForm Form);



    }
}
